<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    
    <title>numpy.ma.cov &mdash; NumPy v1.18 Manual</title>
    
    <link rel="stylesheet" type="text/css" href="../../_static/css/spc-bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../../_static/css/spc-extend.css">
    <link rel="stylesheet" href="../../_static/scipy.css" type="text/css" >
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" >
    <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" >
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '1.18.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/language_data.js"></script>
    <script type="text/javascript" src="../../_static/js/copybutton.js"></script>
    <link rel="author" title="About these documents" href="../../about.html" >
    <link rel="index" title="Index" href="../../genindex.html" >
    <link rel="search" title="Search" href="../../search.html" >
    <link rel="top" title="NumPy v1.18 Manual" href="../../index.html" >
    <link rel="up" title="Masked array operations" href="../routines.ma.html" >
    <link rel="next" title="numpy.ma.cumsum" href="numpy.ma.cumsum.html" >
    <link rel="prev" title="numpy.ma.corrcoef" href="numpy.ma.corrcoef.html" > 
  </head>
  <body>
<div class="container">
  <div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
    <a href="../../index.html">
      <img border=0 alt="NumPy" src="../../_static/numpy_logo.png"></a>
    </div>
  </div>
</div>


    <div class="container">
      <div class="main">
        
	<div class="row-fluid">
	  <div class="span12">
	    <div class="spc-navbar">
              
    <ul class="nav nav-pills pull-left">
        <li class="active"><a href="https://numpy.org/">NumPy.org</a></li>
        <li class="active"><a href="https://numpy.org/doc">Docs</a></li>
        
        <li class="active"><a href="../../index.html">NumPy v1.18 Manual</a></li>
        

          <li class="active"><a href="../index.html" >NumPy Reference</a></li>
          <li class="active"><a href="../arrays.html" >Array objects</a></li>
          <li class="active"><a href="../maskedarray.html" >Masked arrays</a></li>
          <li class="active"><a href="../routines.ma.html" accesskey="U">Masked array operations</a></li> 
    </ul>
              
              
    <ul class="nav nav-pills pull-right">
      <li class="active">
        <a href="../../genindex.html" title="General Index"
           accesskey="I">index</a>
      </li>
      <li class="active">
        <a href="numpy.ma.cumsum.html" title="numpy.ma.cumsum"
           accesskey="N">next</a>
      </li>
      <li class="active">
        <a href="numpy.ma.corrcoef.html" title="numpy.ma.corrcoef"
           accesskey="P">previous</a>
      </li>
    </ul>
              
	    </div>
	  </div>
	</div>
        

	<div class="row-fluid">
      <div class="spc-rightsidebar span3">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="numpy.ma.corrcoef.html"
                        title="previous chapter">numpy.ma.corrcoef</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="numpy.ma.cumsum.html"
                        title="next chapter">numpy.ma.cumsum</a></p>
<div id="searchbox" style="display: none" role="search">
  <h4>Quick search</h4>
    <div>
    <form class="search" action="../../search.html" method="get">
      <input type="text" style="width: inherit;" name="q" />
      <input type="submit" value="search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
          <div class="span9">
            
        <div class="bodywrapper">
          <div class="body" id="spc-section-body">
            
  <div class="section" id="numpy-ma-cov">
<h1>numpy.ma.cov<a class="headerlink" href="#numpy-ma-cov" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="numpy.ma.cov">
<code class="sig-prename descclassname">numpy.ma.</code><code class="sig-name descname">cov</code><span class="sig-paren">(</span><em class="sig-param">x</em>, <em class="sig-param">y=None</em>, <em class="sig-param">rowvar=True</em>, <em class="sig-param">bias=False</em>, <em class="sig-param">allow_masked=True</em>, <em class="sig-param">ddof=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/numpy/numpy/blob/v1.18.1/numpy/ma/extras.py#L1311-L1381"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numpy.ma.cov" title="Permalink to this definition">¶</a></dt>
<dd><p>Estimate the covariance matrix.</p>
<p>Except for the handling of missing data this function does the same as
<a class="reference internal" href="numpy.cov.html#numpy.cov" title="numpy.cov"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.cov</span></code></a>. For more details and examples, see <a class="reference internal" href="numpy.cov.html#numpy.cov" title="numpy.cov"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.cov</span></code></a>.</p>
<p>By default, masked values are recognized as such. If <em class="xref py py-obj">x</em> and <em class="xref py py-obj">y</em> have the
same shape, a common mask is allocated: if <code class="docutils literal notranslate"><span class="pre">x[i,j]</span></code> is masked, then
<code class="docutils literal notranslate"><span class="pre">y[i,j]</span></code> will also be masked.
Setting <em class="xref py py-obj">allow_masked</em> to False will raise an exception if values are
missing in either of the input arrays.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>x</strong><span class="classifier">array_like</span></dt><dd><p>A 1-D or 2-D array containing multiple variables and observations.
Each row of <em class="xref py py-obj">x</em> represents a variable, and each column a single
observation of all those variables. Also see <em class="xref py py-obj">rowvar</em> below.</p>
</dd>
<dt><strong>y</strong><span class="classifier">array_like, optional</span></dt><dd><p>An additional set of variables and observations. <em class="xref py py-obj">y</em> has the same
form as <em class="xref py py-obj">x</em>.</p>
</dd>
<dt><strong>rowvar</strong><span class="classifier">bool, optional</span></dt><dd><p>If <em class="xref py py-obj">rowvar</em> is True (default), then each row represents a
variable, with observations in the columns. Otherwise, the relationship
is transposed: each column represents a variable, while the rows
contain observations.</p>
</dd>
<dt><strong>bias</strong><span class="classifier">bool, optional</span></dt><dd><p>Default normalization (False) is by <code class="docutils literal notranslate"><span class="pre">(N-1)</span></code>, where <code class="docutils literal notranslate"><span class="pre">N</span></code> is the
number of observations given (unbiased estimate). If <em class="xref py py-obj">bias</em> is True,
then normalization is by <code class="docutils literal notranslate"><span class="pre">N</span></code>. This keyword can be overridden by
the keyword <code class="docutils literal notranslate"><span class="pre">ddof</span></code> in numpy versions &gt;= 1.5.</p>
</dd>
<dt><strong>allow_masked</strong><span class="classifier">bool, optional</span></dt><dd><p>If True, masked values are propagated pair-wise: if a value is masked
in <em class="xref py py-obj">x</em>, the corresponding value is masked in <em class="xref py py-obj">y</em>.
If False, raises a <em class="xref py py-obj">ValueError</em> exception when some values are missing.</p>
</dd>
<dt><strong>ddof</strong><span class="classifier">{None, int}, optional</span></dt><dd><p>If not <code class="docutils literal notranslate"><span class="pre">None</span></code> normalization is by <code class="docutils literal notranslate"><span class="pre">(N</span> <span class="pre">-</span> <span class="pre">ddof)</span></code>, where <code class="docutils literal notranslate"><span class="pre">N</span></code> is
the number of observations; this overrides the value implied by
<code class="docutils literal notranslate"><span class="pre">bias</span></code>. The default value is <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 1.5.</span></p>
</div>
</dd>
</dl>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>ValueError</strong></dt><dd><p>Raised if some values are missing and <em class="xref py py-obj">allow_masked</em> is False.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="numpy.cov.html#numpy.cov" title="numpy.cov"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.cov</span></code></a></p>
</div>
</dd></dl>

</div>


          </div>
        </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container container-navbar-bottom">
      <div class="spc-navbar">
        
      </div>
    </div>
    <div class="container">
    <div class="footer">
    <div class="row-fluid">
    <ul class="inline pull-left">
      <li>
        &copy; Copyright 2008-2019, The SciPy community.
      </li>
      <li>
      Last updated on Feb 20, 2020.
      </li>
      <li>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.4.2.
      </li>
    </ul>
    </div>
    </div>
    </div>
  </body>
</html>